class Hero extends egret.DisplayObjectContainer {
	public constructor() {
		super()
		this.addEventListener(egret.Event.ADDED_TO_STAGE,this.createHero,this)
	}


	private bgRun
	private a = 0;
    // private hero = new eui.Image()
	private createHero(){
		let hero = Utils.creatImg("Mc_player1_png")
		this.addChild(hero)
		this.width = hero.width
		this.height = hero.height

	//自由落体	
		let down = setInterval(()=>{
			// this.hero.y+=4
			hero.y+=4
		//游戏结束	
			// if(this.hero.y + this.hero.height*.5 > this.stage.stageHeight){
			if(this.y + this.height*.5 > this.stage.stageHeight){
				clearInterval(down)
			}
		},20)
	
	//跳跃次数
		this.stage.addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
			this.a++
			// if(this.a < 3){
				// egret.Tween.get(this.hero).to({y:this.hero.y-250},500)
				egret.Tween.get(hero).to({y:this.y-250},500)
			// }
		},this)
	}


}